<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Hardware Abstraction Layer (HAL)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="logo.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Hardware Abstraction Layer (HAL)</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('group__group__hal__pdmpcm.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#groups">API Reference</a> &#124;
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">PDM/PCM (Pulse-Density Modulation to Pulse-Code Modulation Converter)<div class="ingroups"><a class="el" href="group__group__hal.html">HAL Drivers</a></div></div></div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p >High level interface for interacting with the pulse-density modulation to pulse-code modulation (PDM/PCM) converter. </p>
<p >The PDM/PCM converter is a asynchronous operation. A PDM-PCM converter is used to convert 1-bit digital audio streaming data to PCM data. The sample rate, word size, and channels can all be configured.</p>
<h1><a class="anchor" id="section_pdmpcm_features"></a>
Features</h1>
<ul>
<li>Supports FIFO buffer for Incoming Data</li>
<li>Configurable Gain Settings</li>
<li>Configurable Word Length</li>
<li>Configurable interrupt and callback assignment from PDM/PCM events - <a class="el" href="group__group__hal__pdmpcm.html#gae66c80c5bbcd3bb7bcfea6821fd009b7">cyhal_pdm_pcm_event_t</a></li>
</ul>
<h1><a class="anchor" id="section_pdmpcm_quickstart"></a>
Quick Start</h1>
<p >Initialize a PDM/PCM converter instance using the <a class="el" href="group__group__hal__pdmpcm.html#gac2baa0d5162498463cc5228e0ab70909">cyhal_pdm_pcm_init</a> and provide the clock and data pins.<br  />
 See <a class="el" href="group__group__hal__pdmpcm.html#subsection_pdmpcm_snippet_1">Snippet 1: PDM/PCM Initialization and Configuration</a> for example initialization. </p><dl class="section note"><dt>Note</dt><dd>The clock parameter (const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *clk) is optional and can be set to NULL to generate and use an available clock resource with a default frequency.</dd></dl>
<h1><a class="anchor" id="section_pdmpcm_snippets"></a>
Code Snippets</h1>
<dl class="section note"><dt>Note</dt><dd>Error checking is omitted for clarity</dd></dl>
<h2><a class="anchor" id="subsection_pdmpcm_snippet_1"></a>
Snippet 1: PDM/PCM Initialization and Configuration</h2>
<p >This snippet initializes a PCM/PCM resource for conversion and assigns the pins.</p>
<div class="fragment"><div class="line">    <a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a>     pdm_pcm;</div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__pdmpcm.html#structcyhal__pdm__pcm__cfg__t">cyhal_pdm_pcm_cfg_t</a> cfg =</div>
<div class="line">    {</div>
<div class="line">        .<a class="code hl_variable" href="group__group__hal__pdmpcm.html#a19eeeb8ba0eaed3b82bf4f052e36b731">sample_rate</a>     = 44000,</div>
<div class="line">        .decimation_rate = 10,</div>
<div class="line">        .mode            = <a class="code hl_enumvalue" href="group__group__hal__pdmpcm.html#ggac81a68ee166ff48752095f82e6852565a3422b29a54a23f1133a62c2b566196dc">CYHAL_PDM_PCM_MODE_STEREO</a>,</div>
<div class="line">        .word_length     = 16,</div>
<div class="line">        .left_gain       = 1,  <span class="comment">// +0.5 db gain</span></div>
<div class="line">        .right_gain      = -2, <span class="comment">// -1.0 db gain</span></div>
<div class="line">    };</div>
<div class="line">    <a class="code hl_typedef" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> result = <a class="code hl_function" href="group__group__hal__pdmpcm.html#gac2baa0d5162498463cc5228e0ab70909">cyhal_pdm_pcm_init</a>(&amp;pdm_pcm, <a class="code hl_enumvalue" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#gga707195ce0627016bf371643bdd9caa51aad04d2399d62b5af8c88438d56ddf99b">P0_5</a>, <a class="code hl_enumvalue" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#gga707195ce0627016bf371643bdd9caa51a8f9331cecf3c8f1bf81bc66386c8b4c1">P0_4</a>, NULL, &amp;cfg);</div>
<div class="line">    CY_ASSERT(<a class="code hl_define" href="group__group__result.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a> == result);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// When the PDM/PCM instance is no longer required, free it to release resources</span></div>
<div class="line">    <a class="code hl_function" href="group__group__hal__pdmpcm.html#ga89ce18cbdd29884ea093ea413df76c6f">cyhal_pdm_pcm_free</a>(&amp;pdm_pcm);</div>
<div class="ttc" id="agroup__group__hal__impl__hw__types_html_structcyhal__pdm__pcm__t"><div class="ttname"><a href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a></div><div class="ttdoc">PDM-PCM object.</div><div class="ttdef"><b>Definition:</b> cyhal_hw_types.h:928</div></div>
<div class="ttc" id="agroup__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble_html_gga707195ce0627016bf371643bdd9caa51a8f9331cecf3c8f1bf81bc66386c8b4c1"><div class="ttname"><a href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#gga707195ce0627016bf371643bdd9caa51a8f9331cecf3c8f1bf81bc66386c8b4c1">P0_4</a></div><div class="ttdeci">@ P0_4</div><div class="ttdoc">Port 0 Pin 4.</div><div class="ttdef"><b>Definition:</b> cyhal_psoc6_01_104_m_csp_ble.h:59</div></div>
<div class="ttc" id="agroup__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble_html_gga707195ce0627016bf371643bdd9caa51aad04d2399d62b5af8c88438d56ddf99b"><div class="ttname"><a href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#gga707195ce0627016bf371643bdd9caa51aad04d2399d62b5af8c88438d56ddf99b">P0_5</a></div><div class="ttdeci">@ P0_5</div><div class="ttdoc">Port 0 Pin 5.</div><div class="ttdef"><b>Definition:</b> cyhal_psoc6_01_104_m_csp_ble.h:60</div></div>
<div class="ttc" id="agroup__group__hal__pdmpcm_html_a19eeeb8ba0eaed3b82bf4f052e36b731"><div class="ttname"><a href="group__group__hal__pdmpcm.html#a19eeeb8ba0eaed3b82bf4f052e36b731">cyhal_pdm_pcm_cfg_t::sample_rate</a></div><div class="ttdeci">uint32_t sample_rate</div><div class="ttdoc">Sample rate in Hz.</div><div class="ttdef"><b>Definition:</b> cyhal_pdmpcm.h:144</div></div>
<div class="ttc" id="agroup__group__hal__pdmpcm_html_ga89ce18cbdd29884ea093ea413df76c6f"><div class="ttname"><a href="group__group__hal__pdmpcm.html#ga89ce18cbdd29884ea093ea413df76c6f">cyhal_pdm_pcm_free</a></div><div class="ttdeci">void cyhal_pdm_pcm_free(cyhal_pdm_pcm_t *obj)</div><div class="ttdoc">Release a PDM/PCM object, behavior is undefined if an asynchronous read is in progress.</div></div>
<div class="ttc" id="agroup__group__hal__pdmpcm_html_gac2baa0d5162498463cc5228e0ab70909"><div class="ttname"><a href="group__group__hal__pdmpcm.html#gac2baa0d5162498463cc5228e0ab70909">cyhal_pdm_pcm_init</a></div><div class="ttdeci">cy_rslt_t cyhal_pdm_pcm_init(cyhal_pdm_pcm_t *obj, cyhal_gpio_t pin_data, cyhal_gpio_t pin_clk, const cyhal_clock_t *clk_source, const cyhal_pdm_pcm_cfg_t *cfg)</div><div class="ttdoc">Initialize the PDM/PCM peripheral.</div></div>
<div class="ttc" id="agroup__group__hal__pdmpcm_html_ggac81a68ee166ff48752095f82e6852565a3422b29a54a23f1133a62c2b566196dc"><div class="ttname"><a href="group__group__hal__pdmpcm.html#ggac81a68ee166ff48752095f82e6852565a3422b29a54a23f1133a62c2b566196dc">CYHAL_PDM_PCM_MODE_STEREO</a></div><div class="ttdeci">@ CYHAL_PDM_PCM_MODE_STEREO</div><div class="ttdoc">The channel stereo.</div><div class="ttdef"><b>Definition:</b> cyhal_pdmpcm.h:138</div></div>
<div class="ttc" id="agroup__group__hal__pdmpcm_html_structcyhal__pdm__pcm__cfg__t"><div class="ttname"><a href="group__group__hal__pdmpcm.html#structcyhal__pdm__pcm__cfg__t">cyhal_pdm_pcm_cfg_t</a></div><div class="ttdoc">Describes the current configuration of a PDM/PCM.</div><div class="ttdef"><b>Definition:</b> cyhal_pdmpcm.h:143</div></div>
<div class="ttc" id="agroup__group__result_html_gaca79700fcc701534ce61778a9bcf57d1"><div class="ttname"><a href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a></div><div class="ttdeci">uint32_t cy_rslt_t</div><div class="ttdoc">Provides the result of an operation as a structured bitfield.</div><div class="ttdef"><b>Definition:</b> cy_result.h:438</div></div>
<div class="ttc" id="agroup__group__result_html_gaf58fac450d9fff4472f03ad68f6e546e"><div class="ttname"><a href="group__group__result.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a></div><div class="ttdeci">#define CY_RSLT_SUCCESS</div><div class="ttdoc">cy_rslt_t return value indicating success</div><div class="ttdef"><b>Definition:</b> cy_result.h:465</div></div>
</div><!-- fragment --><h2><a class="anchor" id="subsection_pdmpcm_snippet_2"></a>
Snippet 2: PDM/PCM Asynchronous Receive</h2>
<p >This snippet shows how to receive data in the background using <a class="el" href="group__group__hal__pdmpcm.html#gab67389b3ca9173afb980824564dba031">cyhal_pdm_pcm_read_async</a>. Notification of the asynchronous read completion is achieved by using <a class="el" href="group__group__hal__pdmpcm.html#ga788431478c16508839c16bcd76681dac">cyhal_pdm_pcm_register_callback</a> to register a callback function and <a class="el" href="group__group__hal__pdmpcm.html#gac32c975ba7bd470359c0e235bcdd82e7">cyhal_pdm_pcm_enable_event</a> to enable callling the callback when an synchonous read completes.</p>
<div class="fragment"><div class="line"><span class="comment">// We use a dual buffer system so that one buffer can be filling while the other is being processed</span></div>
<div class="line"><span class="preprocessor">#if defined(COMPONENT_CAT1A)</span></div>
<div class="line"><span class="preprocessor">#define BUFFER_SIZE 128u</span></div>
<div class="line"><span class="preprocessor">#elif defined(COMPONENT_CAT1B)</span></div>
<div class="line"><span class="preprocessor">#define BUFFER_SIZE 32u</span></div>
<div class="line"><span class="preprocessor">#endif</span></div>
<div class="line"><span class="keyword">static</span> uint32_t  rx_buffer0[BUFFER_SIZE];</div>
<div class="line"><span class="keyword">static</span> uint32_t  rx_buffer1[BUFFER_SIZE];</div>
<div class="line"><span class="keyword">static</span> uint32_t* active_rx_buffer;</div>
<div class="line"><span class="keyword">static</span> uint32_t* full_rx_buffer;</div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> pdm_pcm_event_handler(<span class="keywordtype">void</span>* arg, <a class="code hl_enumeration" href="group__group__hal__pdmpcm.html#gae66c80c5bbcd3bb7bcfea6821fd009b7">cyhal_pdm_pcm_event_t</a> event)</div>
<div class="line">{</div>
<div class="line">    <span class="comment">// When we registered the callback, we set &#39;arg&#39; to point to the pdm_pcm object</span></div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a>* pdm_pcm = (<a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a>*)arg;</div>
<div class="line">    <span class="keywordflow">if</span> (0u != (event &amp; <a class="code hl_enumvalue" href="group__group__hal__pdmpcm.html#ggae66c80c5bbcd3bb7bcfea6821fd009b7a614d379497b9b51176dd7fedee414fdc">CYHAL_PDM_PCM_ASYNC_COMPLETE</a>))</div>
<div class="line">    {</div>
<div class="line">        <span class="comment">// Flip the active and the next rx buffers</span></div>
<div class="line">        uint32_t* temp = active_rx_buffer;</div>
<div class="line">        active_rx_buffer = full_rx_buffer;</div>
<div class="line">        full_rx_buffer   = temp;</div>
<div class="line"> </div>
<div class="line">        <span class="comment">// Start reading into the next buffer while the just-filled one is being processed</span></div>
<div class="line">        <a class="code hl_function" href="group__group__hal__pdmpcm.html#gab67389b3ca9173afb980824564dba031">cyhal_pdm_pcm_read_async</a>(pdm_pcm, active_rx_buffer, BUFFER_SIZE);</div>
<div class="line"> </div>
<div class="line">        <span class="comment">// Process the data in the full_rx_buffer</span></div>
<div class="line">    }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> snippet_cyhal_pdm_pcm_async_receive(<span class="keywordtype">void</span>)</div>
<div class="line">{</div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> pdm_pcm;</div>
<div class="line">    <span class="comment">// Initialize the object as shown in Snippet 1</span></div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Register a callback and set the callback argument to be a pointer to the PDM/PCM object, so</span></div>
<div class="line">    <span class="comment">// that we can easily reference it from the callback handler.</span></div>
<div class="line">    <a class="code hl_function" href="group__group__hal__pdmpcm.html#ga788431478c16508839c16bcd76681dac">cyhal_pdm_pcm_register_callback</a>(&amp;pdm_pcm, &amp;pdm_pcm_event_handler, &amp;pdm_pcm);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Subscribe to the async complete event so that we can queue up another transfer when this one</span></div>
<div class="line">    <span class="comment">// completes</span></div>
<div class="line">    <a class="code hl_function" href="group__group__hal__pdmpcm.html#gac32c975ba7bd470359c0e235bcdd82e7">cyhal_pdm_pcm_enable_event</a>(&amp;pdm_pcm, <a class="code hl_enumvalue" href="group__group__hal__pdmpcm.html#ggae66c80c5bbcd3bb7bcfea6821fd009b7a614d379497b9b51176dd7fedee414fdc">CYHAL_PDM_PCM_ASYNC_COMPLETE</a>, <a class="code hl_define" href="group__group__hal__impl__hw__types.html#gad822a466fc63847114add720ef84c83a">CYHAL_ISR_PRIORITY_DEFAULT</a>,</div>
<div class="line">                               <span class="keyword">true</span>);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Configure asynchronous transfers to use DMA to free up the CPU during transfers</span></div>
<div class="line">    <a class="code hl_function" href="group__group__hal__pdmpcm.html#ga2296229eed2643ba0a938c3437c6ce82">cyhal_pdm_pcm_set_async_mode</a>(&amp;pdm_pcm, <a class="code hl_enumvalue" href="group__group__hal__general__types.html#ggab2d2acfb82599df54152be0b170c6ec2a580896db2028c77f9f89cb8772a1eb90">CYHAL_ASYNC_DMA</a>, <a class="code hl_define" href="group__group__hal__impl__dma.html#ga81946da56dd6ba8afd28f6056b1d779a">CYHAL_DMA_PRIORITY_DEFAULT</a>);</div>
<div class="line"> </div>
<div class="line">    active_rx_buffer = rx_buffer0;</div>
<div class="line">    full_rx_buffer   = rx_buffer1;</div>
<div class="line">    <a class="code hl_function" href="group__group__hal__pdmpcm.html#gab67389b3ca9173afb980824564dba031">cyhal_pdm_pcm_read_async</a>(&amp;pdm_pcm, active_rx_buffer, BUFFER_SIZE);</div>
<div class="line"> </div>
<div class="line">    <a class="code hl_function" href="group__group__hal__pdmpcm.html#gabbab5aafb181de83230b834074994b61">cyhal_pdm_pcm_start</a>(&amp;pdm_pcm);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="ttc" id="agroup__group__hal__general__types_html_ggab2d2acfb82599df54152be0b170c6ec2a580896db2028c77f9f89cb8772a1eb90"><div class="ttname"><a href="group__group__hal__general__types.html#ggab2d2acfb82599df54152be0b170c6ec2a580896db2028c77f9f89cb8772a1eb90">CYHAL_ASYNC_DMA</a></div><div class="ttdeci">@ CYHAL_ASYNC_DMA</div><div class="ttdoc">Use DMA if available.</div><div class="ttdef"><b>Definition:</b> cyhal_general_types.h:114</div></div>
<div class="ttc" id="agroup__group__hal__impl__dma_html_ga81946da56dd6ba8afd28f6056b1d779a"><div class="ttname"><a href="group__group__hal__impl__dma.html#ga81946da56dd6ba8afd28f6056b1d779a">CYHAL_DMA_PRIORITY_DEFAULT</a></div><div class="ttdeci">#define CYHAL_DMA_PRIORITY_DEFAULT</div><div class="ttdoc">Default DMA channel priority.</div><div class="ttdef"><b>Definition:</b> cyhal_dma_impl.h:66</div></div>
<div class="ttc" id="agroup__group__hal__impl__hw__types_html_gad822a466fc63847114add720ef84c83a"><div class="ttname"><a href="group__group__hal__impl__hw__types.html#gad822a466fc63847114add720ef84c83a">CYHAL_ISR_PRIORITY_DEFAULT</a></div><div class="ttdeci">#define CYHAL_ISR_PRIORITY_DEFAULT</div><div class="ttdoc">Priority that is applied by default to all drivers when initialized.</div><div class="ttdef"><b>Definition:</b> cyhal_hw_types.h:114</div></div>
<div class="ttc" id="agroup__group__hal__pdmpcm_html_ga2296229eed2643ba0a938c3437c6ce82"><div class="ttname"><a href="group__group__hal__pdmpcm.html#ga2296229eed2643ba0a938c3437c6ce82">cyhal_pdm_pcm_set_async_mode</a></div><div class="ttdeci">cy_rslt_t cyhal_pdm_pcm_set_async_mode(cyhal_pdm_pcm_t *obj, cyhal_async_mode_t mode, uint8_t dma_priority)</div><div class="ttdoc">Set the mechanism that is used to perform PDM/PCM asynchronous operation.</div></div>
<div class="ttc" id="agroup__group__hal__pdmpcm_html_ga788431478c16508839c16bcd76681dac"><div class="ttname"><a href="group__group__hal__pdmpcm.html#ga788431478c16508839c16bcd76681dac">cyhal_pdm_pcm_register_callback</a></div><div class="ttdeci">void cyhal_pdm_pcm_register_callback(cyhal_pdm_pcm_t *obj, cyhal_pdm_pcm_event_callback_t callback, void *callback_arg)</div><div class="ttdoc">Register a PDM/PCM event handler.</div></div>
<div class="ttc" id="agroup__group__hal__pdmpcm_html_gab67389b3ca9173afb980824564dba031"><div class="ttname"><a href="group__group__hal__pdmpcm.html#gab67389b3ca9173afb980824564dba031">cyhal_pdm_pcm_read_async</a></div><div class="ttdeci">cy_rslt_t cyhal_pdm_pcm_read_async(cyhal_pdm_pcm_t *obj, void *data, size_t length)</div><div class="ttdoc">Begin asynchronous PDM/PCM read.</div></div>
<div class="ttc" id="agroup__group__hal__pdmpcm_html_gabbab5aafb181de83230b834074994b61"><div class="ttname"><a href="group__group__hal__pdmpcm.html#gabbab5aafb181de83230b834074994b61">cyhal_pdm_pcm_start</a></div><div class="ttdeci">cy_rslt_t cyhal_pdm_pcm_start(cyhal_pdm_pcm_t *obj)</div><div class="ttdoc">Start the PDM/PCM operation.</div></div>
<div class="ttc" id="agroup__group__hal__pdmpcm_html_gac32c975ba7bd470359c0e235bcdd82e7"><div class="ttname"><a href="group__group__hal__pdmpcm.html#gac32c975ba7bd470359c0e235bcdd82e7">cyhal_pdm_pcm_enable_event</a></div><div class="ttdeci">void cyhal_pdm_pcm_enable_event(cyhal_pdm_pcm_t *obj, cyhal_pdm_pcm_event_t event, uint8_t intr_priority, bool enable)</div><div class="ttdoc">Configure PDM/PCM event enablement.</div></div>
<div class="ttc" id="agroup__group__hal__pdmpcm_html_gae66c80c5bbcd3bb7bcfea6821fd009b7"><div class="ttname"><a href="group__group__hal__pdmpcm.html#gae66c80c5bbcd3bb7bcfea6821fd009b7">cyhal_pdm_pcm_event_t</a></div><div class="ttdeci">cyhal_pdm_pcm_event_t</div><div class="ttdoc">PDM/PCM interrupt triggers.</div><div class="ttdef"><b>Definition:</b> cyhal_pdmpcm.h:126</div></div>
<div class="ttc" id="agroup__group__hal__pdmpcm_html_ggae66c80c5bbcd3bb7bcfea6821fd009b7a614d379497b9b51176dd7fedee414fdc"><div class="ttname"><a href="group__group__hal__pdmpcm.html#ggae66c80c5bbcd3bb7bcfea6821fd009b7a614d379497b9b51176dd7fedee414fdc">CYHAL_PDM_PCM_ASYNC_COMPLETE</a></div><div class="ttdeci">@ CYHAL_PDM_PCM_ASYNC_COMPLETE</div><div class="ttdoc">Async operation completed.</div><div class="ttdef"><b>Definition:</b> cyhal_pdmpcm.h:131</div></div>
</div><!-- fragment --><h1><a class="anchor" id="subsection_pdmpcm_moreinformation"></a>
More Information</h1>
<p ><b>Code examples (Github)</b></p><ul>
<li><a href="https://github.com/infineon/mtb-example-psoc6-pdm-pcm"><b> PSoC™ 6 MCU: PDM-to-PCM</b></a></li>
<li><a href="https://github.com/infineon/mtb-example-psoc6-pdm-to-i2s"><b> PSoC™ 6 MCU: PDM to I2S</b></a> </li>
</ul>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="groups" name="groups"></a>
API Reference</h2></td></tr>
<tr class="memitem:group__group__hal__results__pdmpcm"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__results__pdmpcm.html">PDM/PCM HAL Results</a></td></tr>
<tr class="memdesc:group__group__hal__results__pdmpcm"><td class="mdescLeft">&#160;</td><td class="mdescRight">PDM/PCM specific return codes. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:structcyhal__pdm__pcm__cfg__t"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__pdmpcm.html#structcyhal__pdm__pcm__cfg__t">cyhal_pdm_pcm_cfg_t</a></td></tr>
<tr class="memdesc:structcyhal__pdm__pcm__cfg__t"><td class="mdescLeft">&#160;</td><td class="mdescRight">Describes the current configuration of a PDM/PCM.  <a href="group__group__hal__pdmpcm.html#structcyhal__pdm__pcm__cfg__t">More...</a><br /></td></tr>
<tr class="separator:structcyhal__pdm__pcm__cfg__t"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="typedef-members" name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:gac01795c2aaebf0b8c73bb6d82c4be198"><td class="memItemLeft" align="right" valign="top"><a id="gac01795c2aaebf0b8c73bb6d82c4be198" name="gac01795c2aaebf0b8c73bb6d82c4be198"></a>
typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><b>cyhal_pdm_pcm_event_callback_t</b>) (void *handler_arg, <a class="el" href="group__group__hal__pdmpcm.html#gae66c80c5bbcd3bb7bcfea6821fd009b7">cyhal_pdm_pcm_event_t</a> event)</td></tr>
<tr class="memdesc:gac01795c2aaebf0b8c73bb6d82c4be198"><td class="mdescLeft">&#160;</td><td class="mdescRight">Handler for PDM/PCM interrupts. <br /></td></tr>
<tr class="separator:gac01795c2aaebf0b8c73bb6d82c4be198"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="enum-members" name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:gae66c80c5bbcd3bb7bcfea6821fd009b7"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__pdmpcm.html#gae66c80c5bbcd3bb7bcfea6821fd009b7">cyhal_pdm_pcm_event_t</a> { <br />
&#160;&#160;<a class="el" href="group__group__hal__pdmpcm.html#ggae66c80c5bbcd3bb7bcfea6821fd009b7a23cdac0a9d48999fd992d2b6ec0c6d46">CYHAL_PDM_PCM_RX_HALF_FULL</a> = 0x01
, <br />
&#160;&#160;<a class="el" href="group__group__hal__pdmpcm.html#ggae66c80c5bbcd3bb7bcfea6821fd009b7a7d033c3845dfddec84d445d36dfc6cd1">CYHAL_PDM_PCM_RX_NOT_EMPTY</a> = 0x02
, <br />
&#160;&#160;<a class="el" href="group__group__hal__pdmpcm.html#ggae66c80c5bbcd3bb7bcfea6821fd009b7a1f4fabcea8eab0bcaa83e790bc9bf9d7">CYHAL_PDM_PCM_RX_OVERFLOW</a> = 0x04
, <br />
&#160;&#160;<a class="el" href="group__group__hal__pdmpcm.html#ggae66c80c5bbcd3bb7bcfea6821fd009b7a96b6aab4d2062870825335c3eb08ce7d">CYHAL_PDM_PCM_RX_UNDERFLOW</a> = 0x08
, <br />
&#160;&#160;<a class="el" href="group__group__hal__pdmpcm.html#ggae66c80c5bbcd3bb7bcfea6821fd009b7a614d379497b9b51176dd7fedee414fdc">CYHAL_PDM_PCM_ASYNC_COMPLETE</a> = 0x10
<br />
 }</td></tr>
<tr class="memdesc:gae66c80c5bbcd3bb7bcfea6821fd009b7"><td class="mdescLeft">&#160;</td><td class="mdescRight">PDM/PCM interrupt triggers.  <a href="group__group__hal__pdmpcm.html#gae66c80c5bbcd3bb7bcfea6821fd009b7">More...</a><br /></td></tr>
<tr class="separator:gae66c80c5bbcd3bb7bcfea6821fd009b7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac81a68ee166ff48752095f82e6852565"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__pdmpcm.html#gac81a68ee166ff48752095f82e6852565">cyhal_pdm_pcm_mode_t</a> { <br />
&#160;&#160;<a class="el" href="group__group__hal__pdmpcm.html#ggac81a68ee166ff48752095f82e6852565a9b6dc0fbdb5ff94c50d3ea447b2e7729">CYHAL_PDM_PCM_MODE_LEFT</a>
, <br />
&#160;&#160;<a class="el" href="group__group__hal__pdmpcm.html#ggac81a68ee166ff48752095f82e6852565a10f63e46718c10aefbc64bfda8b82cfd">CYHAL_PDM_PCM_MODE_RIGHT</a>
, <br />
&#160;&#160;<a class="el" href="group__group__hal__pdmpcm.html#ggac81a68ee166ff48752095f82e6852565a3422b29a54a23f1133a62c2b566196dc">CYHAL_PDM_PCM_MODE_STEREO</a>
<br />
 }</td></tr>
<tr class="memdesc:gac81a68ee166ff48752095f82e6852565"><td class="mdescLeft">&#160;</td><td class="mdescRight">PDM/PCM channel select.  <a href="group__group__hal__pdmpcm.html#gac81a68ee166ff48752095f82e6852565">More...</a><br /></td></tr>
<tr class="separator:gac81a68ee166ff48752095f82e6852565"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gac2baa0d5162498463cc5228e0ab70909"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__pdmpcm.html#gac2baa0d5162498463cc5228e0ab70909">cyhal_pdm_pcm_init</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *obj, <a class="el" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#ga707195ce0627016bf371643bdd9caa51">cyhal_gpio_t</a> pin_data, <a class="el" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#ga707195ce0627016bf371643bdd9caa51">cyhal_gpio_t</a> pin_clk, const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *clk_source, const <a class="el" href="group__group__hal__pdmpcm.html#structcyhal__pdm__pcm__cfg__t">cyhal_pdm_pcm_cfg_t</a> *cfg)</td></tr>
<tr class="memdesc:gac2baa0d5162498463cc5228e0ab70909"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the PDM/PCM peripheral.  <a href="group__group__hal__pdmpcm.html#gac2baa0d5162498463cc5228e0ab70909">More...</a><br /></td></tr>
<tr class="separator:gac2baa0d5162498463cc5228e0ab70909"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gadeb410fdf58134fa1f692e6aeab69708"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__pdmpcm.html#gadeb410fdf58134fa1f692e6aeab69708">cyhal_pdm_pcm_init_cfg</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *obj, const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__configurator__t">cyhal_pdm_pcm_configurator_t</a> *cfg)</td></tr>
<tr class="memdesc:gadeb410fdf58134fa1f692e6aeab69708"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the PDM/PCM out peripheral using a configurator generated configuration struct.  <a href="group__group__hal__pdmpcm.html#gadeb410fdf58134fa1f692e6aeab69708">More...</a><br /></td></tr>
<tr class="separator:gadeb410fdf58134fa1f692e6aeab69708"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga89ce18cbdd29884ea093ea413df76c6f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__pdmpcm.html#ga89ce18cbdd29884ea093ea413df76c6f">cyhal_pdm_pcm_free</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *obj)</td></tr>
<tr class="memdesc:ga89ce18cbdd29884ea093ea413df76c6f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Release a PDM/PCM object, behavior is undefined if an asynchronous read is in progress.  <a href="group__group__hal__pdmpcm.html#ga89ce18cbdd29884ea093ea413df76c6f">More...</a><br /></td></tr>
<tr class="separator:ga89ce18cbdd29884ea093ea413df76c6f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gabbab5aafb181de83230b834074994b61"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__pdmpcm.html#gabbab5aafb181de83230b834074994b61">cyhal_pdm_pcm_start</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *obj)</td></tr>
<tr class="memdesc:gabbab5aafb181de83230b834074994b61"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start the PDM/PCM operation.  <a href="group__group__hal__pdmpcm.html#gabbab5aafb181de83230b834074994b61">More...</a><br /></td></tr>
<tr class="separator:gabbab5aafb181de83230b834074994b61"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae3832916c19f3031dddcee394047e499"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__pdmpcm.html#gae3832916c19f3031dddcee394047e499">cyhal_pdm_pcm_stop</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *obj)</td></tr>
<tr class="memdesc:gae3832916c19f3031dddcee394047e499"><td class="mdescLeft">&#160;</td><td class="mdescRight">Stop the PDM/PCM operation.  <a href="group__group__hal__pdmpcm.html#gae3832916c19f3031dddcee394047e499">More...</a><br /></td></tr>
<tr class="separator:gae3832916c19f3031dddcee394047e499"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga70af22e5c029ef0899d14da93253fcc1"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__pdmpcm.html#ga70af22e5c029ef0899d14da93253fcc1">cyhal_pdm_pcm_is_enabled</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *obj)</td></tr>
<tr class="memdesc:ga70af22e5c029ef0899d14da93253fcc1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks if the specified PDM/PCM peripheral is enabled (regardless of whether any unread data has been received).  <a href="group__group__hal__pdmpcm.html#ga70af22e5c029ef0899d14da93253fcc1">More...</a><br /></td></tr>
<tr class="separator:ga70af22e5c029ef0899d14da93253fcc1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3c945cac4f1db9813d62f35b640fb13b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__pdmpcm.html#ga3c945cac4f1db9813d62f35b640fb13b">cyhal_pdm_pcm_set_gain</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *obj, int16_t gain_left, int16_t gain_right)</td></tr>
<tr class="memdesc:ga3c945cac4f1db9813d62f35b640fb13b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Updates the PDM/PCM channel gains.  <a href="group__group__hal__pdmpcm.html#ga3c945cac4f1db9813d62f35b640fb13b">More...</a><br /></td></tr>
<tr class="separator:ga3c945cac4f1db9813d62f35b640fb13b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4f6559e37a2ea3facdffe3cac6241356"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__pdmpcm.html#ga4f6559e37a2ea3facdffe3cac6241356">cyhal_pdm_pcm_clear</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *obj)</td></tr>
<tr class="memdesc:ga4f6559e37a2ea3facdffe3cac6241356"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clears the hardware buffer.  <a href="group__group__hal__pdmpcm.html#ga4f6559e37a2ea3facdffe3cac6241356">More...</a><br /></td></tr>
<tr class="separator:ga4f6559e37a2ea3facdffe3cac6241356"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5694092b3f4bc66a0a649829d346d1c7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__pdmpcm.html#ga5694092b3f4bc66a0a649829d346d1c7">cyhal_pdm_pcm_read</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *obj, void *data, size_t *length)</td></tr>
<tr class="memdesc:ga5694092b3f4bc66a0a649829d346d1c7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads data synchronously.  <a href="group__group__hal__pdmpcm.html#ga5694092b3f4bc66a0a649829d346d1c7">More...</a><br /></td></tr>
<tr class="separator:ga5694092b3f4bc66a0a649829d346d1c7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab67389b3ca9173afb980824564dba031"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__pdmpcm.html#gab67389b3ca9173afb980824564dba031">cyhal_pdm_pcm_read_async</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *obj, void *data, size_t length)</td></tr>
<tr class="memdesc:gab67389b3ca9173afb980824564dba031"><td class="mdescLeft">&#160;</td><td class="mdescRight">Begin asynchronous PDM/PCM read.  <a href="group__group__hal__pdmpcm.html#gab67389b3ca9173afb980824564dba031">More...</a><br /></td></tr>
<tr class="separator:gab67389b3ca9173afb980824564dba031"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9510e6cfe34d3279aaa2fcf015e24288"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__pdmpcm.html#ga9510e6cfe34d3279aaa2fcf015e24288">cyhal_pdm_pcm_is_pending</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *obj)</td></tr>
<tr class="memdesc:ga9510e6cfe34d3279aaa2fcf015e24288"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks if an async read operation is pending.  <a href="group__group__hal__pdmpcm.html#ga9510e6cfe34d3279aaa2fcf015e24288">More...</a><br /></td></tr>
<tr class="separator:ga9510e6cfe34d3279aaa2fcf015e24288"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5db8d3906cdd3cd0e2cadcb6a283d910"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__pdmpcm.html#ga5db8d3906cdd3cd0e2cadcb6a283d910">cyhal_pdm_pcm_abort_async</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *obj)</td></tr>
<tr class="memdesc:ga5db8d3906cdd3cd0e2cadcb6a283d910"><td class="mdescLeft">&#160;</td><td class="mdescRight">Abort an PDM/PCM operation started by cyhal_pdm_pcm_read_async function.  <a href="group__group__hal__pdmpcm.html#ga5db8d3906cdd3cd0e2cadcb6a283d910">More...</a><br /></td></tr>
<tr class="separator:ga5db8d3906cdd3cd0e2cadcb6a283d910"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga788431478c16508839c16bcd76681dac"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__pdmpcm.html#ga788431478c16508839c16bcd76681dac">cyhal_pdm_pcm_register_callback</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *obj, <a class="el" href="group__group__hal__pdmpcm.html#gac01795c2aaebf0b8c73bb6d82c4be198">cyhal_pdm_pcm_event_callback_t</a> callback, void *callback_arg)</td></tr>
<tr class="memdesc:ga788431478c16508839c16bcd76681dac"><td class="mdescLeft">&#160;</td><td class="mdescRight">Register a PDM/PCM event handler.  <a href="group__group__hal__pdmpcm.html#ga788431478c16508839c16bcd76681dac">More...</a><br /></td></tr>
<tr class="separator:ga788431478c16508839c16bcd76681dac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac32c975ba7bd470359c0e235bcdd82e7"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__pdmpcm.html#gac32c975ba7bd470359c0e235bcdd82e7">cyhal_pdm_pcm_enable_event</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *obj, <a class="el" href="group__group__hal__pdmpcm.html#gae66c80c5bbcd3bb7bcfea6821fd009b7">cyhal_pdm_pcm_event_t</a> event, uint8_t intr_priority, bool enable)</td></tr>
<tr class="memdesc:gac32c975ba7bd470359c0e235bcdd82e7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Configure PDM/PCM event enablement.  <a href="group__group__hal__pdmpcm.html#gac32c975ba7bd470359c0e235bcdd82e7">More...</a><br /></td></tr>
<tr class="separator:gac32c975ba7bd470359c0e235bcdd82e7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2296229eed2643ba0a938c3437c6ce82"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__pdmpcm.html#ga2296229eed2643ba0a938c3437c6ce82">cyhal_pdm_pcm_set_async_mode</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *obj, <a class="el" href="group__group__hal__general__types.html#gab2d2acfb82599df54152be0b170c6ec2">cyhal_async_mode_t</a> mode, uint8_t dma_priority)</td></tr>
<tr class="memdesc:ga2296229eed2643ba0a938c3437c6ce82"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the mechanism that is used to perform PDM/PCM asynchronous operation.  <a href="group__group__hal__pdmpcm.html#ga2296229eed2643ba0a938c3437c6ce82">More...</a><br /></td></tr>
<tr class="separator:ga2296229eed2643ba0a938c3437c6ce82"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<hr/><h2 class="groupheader">Data Structure Documentation</h2>
<a name="structcyhal__pdm__pcm__cfg__t" id="structcyhal__pdm__pcm__cfg__t"></a>
<h2 class="memtitle"><span class="permalink"><a href="#structcyhal__pdm__pcm__cfg__t">&#9670;&nbsp;</a></span>cyhal_pdm_pcm_cfg_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct cyhal_pdm_pcm_cfg_t</td>
        </tr>
      </table>
</div><div class="memdoc">
<table class="fieldtable">
<tr><th colspan="3">Data Fields</th></tr>
<tr><td class="fieldtype">
<a id="a19eeeb8ba0eaed3b82bf4f052e36b731" name="a19eeeb8ba0eaed3b82bf4f052e36b731"></a>uint32_t</td>
<td class="fieldname">
sample_rate</td>
<td class="fielddoc">
Sample rate in Hz. </td></tr>
<tr><td class="fieldtype">
<a id="a737e9a5d4be7b31eda309375b366beb5" name="a737e9a5d4be7b31eda309375b366beb5"></a>uint16_t</td>
<td class="fieldname">
decimation_rate</td>
<td class="fielddoc">
PDM decimation rate. </td></tr>
<tr><td class="fieldtype">
<a id="a7be7271c85209a9f567a1335f58d05ba" name="a7be7271c85209a9f567a1335f58d05ba"></a><a class="el" href="group__group__hal__pdmpcm.html#gac81a68ee166ff48752095f82e6852565">cyhal_pdm_pcm_mode_t</a></td>
<td class="fieldname">
mode</td>
<td class="fielddoc">
left, right, or stereo </td></tr>
<tr><td class="fieldtype">
<a id="a5847815ce526fa0d67e4a5a9d9de21dd" name="a5847815ce526fa0d67e4a5a9d9de21dd"></a>uint8_t</td>
<td class="fieldname">
word_length</td>
<td class="fielddoc">
PCM word length in bits, see the implementation specific documentation for valid range. </td></tr>
<tr><td class="fieldtype">
<a id="a28e191d9695e078f30e4d4f79a127883" name="a28e191d9695e078f30e4d4f79a127883"></a>int16_t</td>
<td class="fieldname">
left_gain</td>
<td class="fielddoc">
PGA in 0.5 dB increment, for example a value of 5 would mean +2.5 dB. <p >The closest fit value will be used, see the implementation specific documentation for valid ranges. This may be negative if the implementation supports it. </p>
</td></tr>
<tr><td class="fieldtype">
<a id="af376c72ce6f362046ab97bed60bbc984" name="af376c72ce6f362046ab97bed60bbc984"></a>int16_t</td>
<td class="fieldname">
right_gain</td>
<td class="fielddoc">
PGA in 0.5 dB increment, for example a value of 5 would mean +2.5 dB. <p >The closest fit value will be used, see the implementation specific documentation for valid ranges. This may be negative if the implementation supports it. </p>
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="gae66c80c5bbcd3bb7bcfea6821fd009b7" name="gae66c80c5bbcd3bb7bcfea6821fd009b7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gae66c80c5bbcd3bb7bcfea6821fd009b7">&#9670;&nbsp;</a></span>cyhal_pdm_pcm_event_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__group__hal__pdmpcm.html#gae66c80c5bbcd3bb7bcfea6821fd009b7">cyhal_pdm_pcm_event_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>PDM/PCM interrupt triggers. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="ggae66c80c5bbcd3bb7bcfea6821fd009b7a23cdac0a9d48999fd992d2b6ec0c6d46" name="ggae66c80c5bbcd3bb7bcfea6821fd009b7a23cdac0a9d48999fd992d2b6ec0c6d46"></a>CYHAL_PDM_PCM_RX_HALF_FULL&#160;</td><td class="fielddoc"><p >RX hardware buffer is half full. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggae66c80c5bbcd3bb7bcfea6821fd009b7a7d033c3845dfddec84d445d36dfc6cd1" name="ggae66c80c5bbcd3bb7bcfea6821fd009b7a7d033c3845dfddec84d445d36dfc6cd1"></a>CYHAL_PDM_PCM_RX_NOT_EMPTY&#160;</td><td class="fielddoc"><p >RX hardware buffer is not empty. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggae66c80c5bbcd3bb7bcfea6821fd009b7a1f4fabcea8eab0bcaa83e790bc9bf9d7" name="ggae66c80c5bbcd3bb7bcfea6821fd009b7a1f4fabcea8eab0bcaa83e790bc9bf9d7"></a>CYHAL_PDM_PCM_RX_OVERFLOW&#160;</td><td class="fielddoc"><p >Attempt to write to a full RX hardware buffer. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggae66c80c5bbcd3bb7bcfea6821fd009b7a96b6aab4d2062870825335c3eb08ce7d" name="ggae66c80c5bbcd3bb7bcfea6821fd009b7a96b6aab4d2062870825335c3eb08ce7d"></a>CYHAL_PDM_PCM_RX_UNDERFLOW&#160;</td><td class="fielddoc"><p >Attempt to read from an empty buffer. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggae66c80c5bbcd3bb7bcfea6821fd009b7a614d379497b9b51176dd7fedee414fdc" name="ggae66c80c5bbcd3bb7bcfea6821fd009b7a614d379497b9b51176dd7fedee414fdc"></a>CYHAL_PDM_PCM_ASYNC_COMPLETE&#160;</td><td class="fielddoc"><p >Async operation completed. </p>
</td></tr>
</table>

</div>
</div>
<a id="gac81a68ee166ff48752095f82e6852565" name="gac81a68ee166ff48752095f82e6852565"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac81a68ee166ff48752095f82e6852565">&#9670;&nbsp;</a></span>cyhal_pdm_pcm_mode_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__group__hal__pdmpcm.html#gac81a68ee166ff48752095f82e6852565">cyhal_pdm_pcm_mode_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>PDM/PCM channel select. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="ggac81a68ee166ff48752095f82e6852565a9b6dc0fbdb5ff94c50d3ea447b2e7729" name="ggac81a68ee166ff48752095f82e6852565a9b6dc0fbdb5ff94c50d3ea447b2e7729"></a>CYHAL_PDM_PCM_MODE_LEFT&#160;</td><td class="fielddoc"><p >The channel mono left. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggac81a68ee166ff48752095f82e6852565a10f63e46718c10aefbc64bfda8b82cfd" name="ggac81a68ee166ff48752095f82e6852565a10f63e46718c10aefbc64bfda8b82cfd"></a>CYHAL_PDM_PCM_MODE_RIGHT&#160;</td><td class="fielddoc"><p >The channel mono right. </p>
</td></tr>
<tr><td class="fieldname"><a id="ggac81a68ee166ff48752095f82e6852565a3422b29a54a23f1133a62c2b566196dc" name="ggac81a68ee166ff48752095f82e6852565a3422b29a54a23f1133a62c2b566196dc"></a>CYHAL_PDM_PCM_MODE_STEREO&#160;</td><td class="fielddoc"><p >The channel stereo. </p>
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="gac2baa0d5162498463cc5228e0ab70909" name="gac2baa0d5162498463cc5228e0ab70909"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac2baa0d5162498463cc5228e0ab70909">&#9670;&nbsp;</a></span>cyhal_pdm_pcm_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_pdm_pcm_init </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#ga707195ce0627016bf371643bdd9caa51">cyhal_gpio_t</a>&#160;</td>
          <td class="paramname"><em>pin_data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#ga707195ce0627016bf371643bdd9caa51">cyhal_gpio_t</a>&#160;</td>
          <td class="paramname"><em>pin_clk</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__clock__t">cyhal_clock_t</a> *&#160;</td>
          <td class="paramname"><em>clk_source</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__group__hal__pdmpcm.html#structcyhal__pdm__pcm__cfg__t">cyhal_pdm_pcm_cfg_t</a> *&#160;</td>
          <td class="paramname"><em>cfg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize the PDM/PCM peripheral. </p>
<p >Configures the pins used by PDM/PCM converter, sets a default format and frequency, and enables the peripheral </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">obj</td><td>Pointer to a PDM/PCM object. The caller must allocate the memory for this object but the init function will initialize its contents. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">pin_data</td><td>The pin to use for PDM input </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">pin_clk</td><td>The pin to use for PDM clock output </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">clk_source</td><td>The clock source for PDM/PCM block </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">cfg</td><td>The configuration for the PDM/PCM block </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the init request </dd></dl>

</div>
</div>
<a id="gadeb410fdf58134fa1f692e6aeab69708" name="gadeb410fdf58134fa1f692e6aeab69708"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gadeb410fdf58134fa1f692e6aeab69708">&#9670;&nbsp;</a></span>cyhal_pdm_pcm_init_cfg()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_pdm_pcm_init_cfg </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__configurator__t">cyhal_pdm_pcm_configurator_t</a> *&#160;</td>
          <td class="paramname"><em>cfg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize the PDM/PCM out peripheral using a configurator generated configuration struct. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">obj</td><td>Pointer to a PDM/PCM object. The caller must allocate the memory for this object but the init function will initialize its contents. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">cfg</td><td>Configuration structure generated by a configurator. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the init request </dd></dl>

</div>
</div>
<a id="ga89ce18cbdd29884ea093ea413df76c6f" name="ga89ce18cbdd29884ea093ea413df76c6f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga89ce18cbdd29884ea093ea413df76c6f">&#9670;&nbsp;</a></span>cyhal_pdm_pcm_free()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cyhal_pdm_pcm_free </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Release a PDM/PCM object, behavior is undefined if an asynchronous read is in progress. </p>
<p >Return the peripheral, pins and clock owned by the PDM/PCM object to their reset state </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">obj</td><td>The PDM/PCM object to deinitialize </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gabbab5aafb181de83230b834074994b61" name="gabbab5aafb181de83230b834074994b61"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gabbab5aafb181de83230b834074994b61">&#9670;&nbsp;</a></span>cyhal_pdm_pcm_start()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_pdm_pcm_start </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Start the PDM/PCM operation. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The PDM/PCM object to start </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the status of the start request </dd></dl>

</div>
</div>
<a id="gae3832916c19f3031dddcee394047e499" name="gae3832916c19f3031dddcee394047e499"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gae3832916c19f3031dddcee394047e499">&#9670;&nbsp;</a></span>cyhal_pdm_pcm_stop()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_pdm_pcm_stop </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Stop the PDM/PCM operation. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The PDM/PCM object to start </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the status of the stop request </dd></dl>

</div>
</div>
<a id="ga70af22e5c029ef0899d14da93253fcc1" name="ga70af22e5c029ef0899d14da93253fcc1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga70af22e5c029ef0899d14da93253fcc1">&#9670;&nbsp;</a></span>cyhal_pdm_pcm_is_enabled()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool cyhal_pdm_pcm_is_enabled </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Checks if the specified PDM/PCM peripheral is enabled (regardless of whether any unread data has been received). </p>
<p >The PDM/PCM peripheral can be enabled by calling <a class="el" href="group__group__hal__pdmpcm.html#gabbab5aafb181de83230b834074994b61">cyhal_pdm_pcm_start</a> and disabled by calling <a class="el" href="group__group__hal__pdmpcm.html#gae3832916c19f3031dddcee394047e499">cyhal_pdm_pcm_stop</a></p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The I2S peripheral to check </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Whether the I2S receive function is enabled. </dd></dl>

</div>
</div>
<a id="ga3c945cac4f1db9813d62f35b640fb13b" name="ga3c945cac4f1db9813d62f35b640fb13b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3c945cac4f1db9813d62f35b640fb13b">&#9670;&nbsp;</a></span>cyhal_pdm_pcm_set_gain()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_pdm_pcm_set_gain </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int16_t&#160;</td>
          <td class="paramname"><em>gain_left</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int16_t&#160;</td>
          <td class="paramname"><em>gain_right</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Updates the PDM/PCM channel gains. </p>
<p >Each integer increment represent a 0.5 dB value. For example: a gain value of 5 would mean +2.5 dB. If the exact gain value requested is not supported, it will be rounded to the nearest legal value. See the implementation specific documentation for valid ranges.</p>
<dl class="section note"><dt>Note</dt><dd>Gains may be negative if the implementation supports it.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The PDM/PCM object to configure </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">gain_left</td><td>The gain of the left channel in units of 0.5 dB </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">gain_right</td><td>The gain of the right channel in units of 0.5 dB </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the set gain operation. An error will be returned if the value is outside of range supported by HW. </dd></dl>

</div>
</div>
<a id="ga4f6559e37a2ea3facdffe3cac6241356" name="ga4f6559e37a2ea3facdffe3cac6241356"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4f6559e37a2ea3facdffe3cac6241356">&#9670;&nbsp;</a></span>cyhal_pdm_pcm_clear()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_pdm_pcm_clear </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Clears the hardware buffer. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The PDM/PCM peripheral </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the clear request </dd></dl>

</div>
</div>
<a id="ga5694092b3f4bc66a0a649829d346d1c7" name="ga5694092b3f4bc66a0a649829d346d1c7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5694092b3f4bc66a0a649829d346d1c7">&#9670;&nbsp;</a></span>cyhal_pdm_pcm_read()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_pdm_pcm_read </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t *&#160;</td>
          <td class="paramname"><em>length</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reads data synchronously. </p>
<p >This will read either <code>length</code> words or the number of words that are currently available in the receive buffer, whichever is less, then return. The value pointed to by <code>length</code> will be updated to reflect the number of words that were actually read. If there are less data in FIFO than length, length will be update with number of words read.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The PDM/PCM peripheral </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">data</td><td>Pointer to word array where incoming data will be stored. Buffer must be aligned to word-size. Each word will be aligned to the next largest power of 2. For example, if the word length is 16 bits, each word will consume two bytes. But if the word length is 20, each word will consume 32 bits. Negative value will use sign-extension. -1 with 24-bit word length will have 32-bit value of 0xFFFFFFFF. </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">length</td><td>Number of 32-bit words to read, updated with the number actually read </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the read request </dd></dl>

</div>
</div>
<a id="gab67389b3ca9173afb980824564dba031" name="gab67389b3ca9173afb980824564dba031"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab67389b3ca9173afb980824564dba031">&#9670;&nbsp;</a></span>cyhal_pdm_pcm_read_async()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_pdm_pcm_read_async </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>length</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Begin asynchronous PDM/PCM read. </p>
<p >This will transfer <code>length</code> words into the buffer pointed to by <code>data</code> in the background. When the requested quantity of data has been read, the <a class="el" href="group__group__hal__pdmpcm.html#ggae66c80c5bbcd3bb7bcfea6821fd009b7a614d379497b9b51176dd7fedee414fdc">CYHAL_PDM_PCM_ASYNC_COMPLETE</a> event will be raised. See <a class="el" href="group__group__hal__pdmpcm.html#ga788431478c16508839c16bcd76681dac">cyhal_pdm_pcm_register_callback</a> and <a class="el" href="group__group__hal__pdmpcm.html#gac32c975ba7bd470359c0e235bcdd82e7">cyhal_pdm_pcm_enable_event</a>.</p>
<p >cyhal_pdm_pcm_set_async_mode can be used to control whether this uses DMA or a CPU-driven transfer.</p>
<dl class="section note"><dt>Note</dt><dd>If D-cache is enabled, cyhal_pdm_pcm_set_async_mode is DMA and data Cache line is 32 bytes, the user needs to make sure that the data pointer passed to the cyhal_pdm_pcm_read_async function points to a 32 byte aligned array of words that contains the buffer data. The size of buffer data must be a multiple of 32 bytes to ensure cache coherency. CY_ALIGN(__SCB_DCACHE_LINE_SIZE) macro can be used for 32 byte alignment.</dd></dl>
<p>Refer to <a class="el" href="md_source_hal_dcache.html#DCACHE_Management">DCACHE_Management</a> for more information.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The PDM/PCM object </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">data</td><td>Pointer to word array where incoming data will be stored. Buffer must be aligned to word-size. Each word will be aligned to the next largest power of 2. For example, if the word length is 16 bits, each word will consume two bytes. But if the word length is 20, each word will consume 32 bits. Negative value will use sign-extension. -1 with 24-bit word length will have 32-bit value of 0xFFFFFFFF. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">length</td><td>Number of words to read </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the read_async request </dd></dl>

</div>
</div>
<a id="ga9510e6cfe34d3279aaa2fcf015e24288" name="ga9510e6cfe34d3279aaa2fcf015e24288"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9510e6cfe34d3279aaa2fcf015e24288">&#9670;&nbsp;</a></span>cyhal_pdm_pcm_is_pending()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool cyhal_pdm_pcm_is_pending </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Checks if an async read operation is pending. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The PDM/PCM peripheral to check </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Indication of whether a PDM/PCM async operation is pending </dd></dl>

</div>
</div>
<a id="ga5db8d3906cdd3cd0e2cadcb6a283d910" name="ga5db8d3906cdd3cd0e2cadcb6a283d910"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5db8d3906cdd3cd0e2cadcb6a283d910">&#9670;&nbsp;</a></span>cyhal_pdm_pcm_abort_async()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_pdm_pcm_abort_async </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Abort an PDM/PCM operation started by cyhal_pdm_pcm_read_async function. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The PDM/PCM peripheral to stop </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the abort_async request </dd></dl>

</div>
</div>
<a id="ga788431478c16508839c16bcd76681dac" name="ga788431478c16508839c16bcd76681dac"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga788431478c16508839c16bcd76681dac">&#9670;&nbsp;</a></span>cyhal_pdm_pcm_register_callback()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cyhal_pdm_pcm_register_callback </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__pdmpcm.html#gac01795c2aaebf0b8c73bb6d82c4be198">cyhal_pdm_pcm_event_callback_t</a>&#160;</td>
          <td class="paramname"><em>callback</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>callback_arg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Register a PDM/PCM event handler. </p>
<p >This function will be called when one of the events enabled by <a class="el" href="group__group__hal__pdmpcm.html#gac32c975ba7bd470359c0e235bcdd82e7">cyhal_pdm_pcm_enable_event</a> occurs.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The PDM/PCM object </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>The callback handler which will be invoked when the interrupt fires </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">callback_arg</td><td>Generic argument that will be provided to the callback when called </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gac32c975ba7bd470359c0e235bcdd82e7" name="gac32c975ba7bd470359c0e235bcdd82e7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac32c975ba7bd470359c0e235bcdd82e7">&#9670;&nbsp;</a></span>cyhal_pdm_pcm_enable_event()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cyhal_pdm_pcm_enable_event </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__pdmpcm.html#gae66c80c5bbcd3bb7bcfea6821fd009b7">cyhal_pdm_pcm_event_t</a>&#160;</td>
          <td class="paramname"><em>event</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>intr_priority</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>enable</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Configure PDM/PCM event enablement. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The PDM/PCM object </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">event</td><td>The PDM/PCM event type </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">intr_priority</td><td>The priority for NVIC interrupt events </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">enable</td><td>True to turn on events, False to turn off </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga2296229eed2643ba0a938c3437c6ce82" name="ga2296229eed2643ba0a938c3437c6ce82"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2296229eed2643ba0a938c3437c6ce82">&#9670;&nbsp;</a></span>cyhal_pdm_pcm_set_async_mode()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_pdm_pcm_set_async_mode </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__pdm__pcm__t">cyhal_pdm_pcm_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__general__types.html#gab2d2acfb82599df54152be0b170c6ec2">cyhal_async_mode_t</a>&#160;</td>
          <td class="paramname"><em>mode</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>dma_priority</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the mechanism that is used to perform PDM/PCM asynchronous operation. </p>
<p >The default is SW.</p>
<p >When an enabled event occurs, the function specified by <a class="el" href="group__group__hal__pdmpcm.html#ga788431478c16508839c16bcd76681dac">cyhal_pdm_pcm_register_callback</a> will be called.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The PDM/PCM object </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">mode</td><td>The transfer mode </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">dma_priority</td><td>The priority, if DMA is used. Valid values are the same as for <a class="el" href="group__group__hal__dma.html#gab9c200507a8ee87b894150416e4f5dd1">cyhal_dma_init</a>. If DMA is not selected, the only valid value is CYHAL_DMA_PRIORITY_DEFAULT, and no guarantees are made about prioritization. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the set mode request </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>Hardware Abstraction Layer (HAL)</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
